<!DOCTYPE html>
<html>

  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Cache-Control" content="no-siteapp" />

    <title>xmake v2.5.2 released, Support pull remote cross-toolchain and package integration</title>
    <meta name="description" content="xmake is a lightweight cross-platform build tool based on Lua. It uses xmake.lua to maintain project builds. Compared with makefile/CMakeLists.txt, the confi...">

    
    <meta name="keywords" content="xmake,lua,C/C++,toolchains,xrepo,packages,cross-toolchains,tboox" /> 

    <!-- qq oauth -->
    <meta property="qc:admins" content="5211601217706727767255" />

    <!--icon -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
    <link rel="icon" sizes="192x192" href="/static/img/nice-highres.png" />
	<link rel="apple-touch-icon-precomposed" href="/static/img/apple-touch-icon-57x57-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="72x72" href="/static/img/apple-touch-icon-72x72-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="114x114" href="/static/img/apple-touch-icon-114x114-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="144x144" href="/static/img/apple-touch-icon-144x144-precomposed.png" />
	<link rel="apple-touch-icon-precomposed" sizes="180x180" href="/static/img/retinahd_icon.png" />
	<meta name="msapplication-TileImage" content="/static/img/retinahd_icon.png" />
	
    <link rel="stylesheet" href=" /css/fontawesome/css/font-awesome.min.css ">
    <link rel="stylesheet" href=" /css/main.css ">
    <link rel="canonical" href="https://tboox.org/2021/02/27/xmake-update-v2.5.2/">
    <link rel="alternate" type="application/rss+xml" title="TBOOX Open Source Project" href="https://tboox.org/feed.xml ">
    <link rel="alternate" hreflang="en" href="https://tboox.org/" />
    <link rel="alternate" hreflang="zh-Hans" href="https://tboox.org/cn/" />




    <script type="text/javascript">
    function isPC(){    
        var userAgentInfo = navigator.userAgent;  
        var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");    
        var flag = true;    
        for (var v = 0; v < Agents.length; v++) {    
            if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }    
        }    
        return flag;    
    }
    </script>

<!-- baidu ads -->



    <!-- baidu ads -->

</head>


  <body>

    <header id="top">
    <div class="wrapper">
        <a href="/" class="brand">TBOOX</a>
        <button id="headerMenu" class="menu"><i class="fa fa-bars"></i></button>
        <nav id="headerNav">
            <ul>
                <li>
                    
                    <a href="/cn?lang=0">
                    
                        <i class="fa fa-home"></i>中文
                    </a>
                </li>

                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/project/">
                            
                        
                            <i class="fa fa-bookmark"></i>Projects
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/archive/">
                            
                        
                            <i class="fa fa-archive"></i>Archives
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/category/">
                            
                        
                            <i class="fa fa-th-list"></i>Categories
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/tag/">
                            
                        
                            <i class="fa fa-tags"></i>Tags
                        </a>
                    </li>
                    
                    
                    
                
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/docs/">
                            
                        
                            <i class="fa fa-book"></i>Documents
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="https://xmake.io/#/about/contact" target="_blank" >
                            
                        
                            <i class="fa fa-forumbee"></i>Community
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/donation/">
                            
                        
                            <i class="fa fa-heart"></i>Donate
                        </a>
                    </li>
                    
                    
                    
                
                    
                     
                    
                
                    
                     
                     
                    <li>

                        
                            
                            <a href="/about/">
                            
                        
                            <i class="fa fa-user"></i>About
                        </a>
                    </li>
                    
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                     
                     
                    
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            </ul>
        </nav>
    </div>
</header>



        <div class="page clearfix" post>
    <div class="left">
        <h1>xmake v2.5.2 released, Support pull remote cross-toolchain and package integration</h1>
        <div class="label">

            <div class="label-card">
                <i class="fa fa-calendar"></i>2021-02-27
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
                
            </div>

            <div class="label-card">
            


<!-- <span class="point">•</span> -->
<span class="categories">
  <i class="fa fa-th-list"></i>
  
    
        <a href="/category/#xmake" title="Category: xmake" rel="category">xmake</a>
    
  

  <!-- <span class="point">•</span> -->
</span>


            </div>

            <div class="label-card">
            
<!-- <span class="point">•</span> -->
<span class="pageTag">
  <i class="fa fa-tags"></i>
  
    
        <!--a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a-->
        <a href="/tag/#xmake" title="Tag: xmake" rel="tag">xmake</a>&nbsp;
    
        <!--a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a-->
        <a href="/tag/#lua" title="Tag: lua" rel="tag">lua</a>&nbsp;
    
        <!--a href="/tag/#C%2FC%2B%2B" title="Tag: C/C++" rel="tag">C/C++</a-->
        <a href="/tag/#C/C++" title="Tag: C/C++" rel="tag">C/C++</a>&nbsp;
    
        <!--a href="/tag/#toolchains" title="Tag: toolchains" rel="tag">toolchains</a-->
        <a href="/tag/#toolchains" title="Tag: toolchains" rel="tag">toolchains</a>&nbsp;
    
        <!--a href="/tag/#xrepo" title="Tag: xrepo" rel="tag">xrepo</a-->
        <a href="/tag/#xrepo" title="Tag: xrepo" rel="tag">xrepo</a>&nbsp;
    
        <!--a href="/tag/#packages" title="Tag: packages" rel="tag">packages</a-->
        <a href="/tag/#packages" title="Tag: packages" rel="tag">packages</a>&nbsp;
    
        <!--a href="/tag/#cross-toolchains" title="Tag: cross-toolchains" rel="tag">cross-toolchains</a-->
        <a href="/tag/#cross-toolchains" title="Tag: cross-toolchains" rel="tag">cross-toolchains</a>
    
  

</span>

            </div>

        </div>
        <hr>
        <article itemscope itemtype="http://schema.org/BlogPosting">
        <p><a href="https://github.com/xmake-io/xmake">xmake</a> is a lightweight cross-platform build tool based on Lua. It uses xmake.lua to maintain project builds. Compared with makefile/CMakeLists.txt, the configuration syntax is more Concise and intuitive, it is very friendly to novices, and you can get started quickly in a short time, allowing users to focus more on actual project development.</p>

<p>In version 2.5.2, we added a heavyweight new feature: <code class="highlighter-rouge">Pull remote cross-compilation toolchain automatically</code>.</p>

<p>Those who have done cross-compilation and have experience in C/C++ project migration should know that it is very troublesome to toss various cross-compilation toolchains
and transplant and compile projects. You need to download the corresponding toolchain yourself.</p>

<p>And it is easy to make mistakes in configuring the toolchain and the compilation environment to cause compilation failure.</p>

<p>Now, xmake can already support the automatic download of the toolchain required by the project, and then use the corresponding toolchain to directly compile the project.
The user does not need to care about how to configure the toolchain. In any case, just execute the <code class="highlighter-rouge">xmake</code> command to complete the compilation.</p>

<p><img src="/static/img/xmake/muslcc.gif" alt="" /></p>

<p>Even for the integration of C/C++ dependent packages, you can automatically switch to the corresponding toolchain to compile, install, and integrate.
Everything is fully automated and does not require users to worry about it.</p>

<p>In addition to the cross-compilation toolchain, we can also automatically pull toolchains, such as specific versions of llvm, llvm-mingw, zig
and other toolchains to participate in the compilation of C/C++/Zig projects.</p>

<p>Even cmake does not support the automatic pull of the toolchain. At most, it can only cooperate with third-party package management such as vcpkg/conan to integrate C/C++ dependent packages.
In addition, even for C/C++ dependent packages, xmake has its own native The built-in package management tool has no dependencies at all.</p>

<ul>
  <li><a href="https://github.com/xmake-io/xmake">Github</a></li>
  <li><a href="https://xmake.io/">Document</a></li>
</ul>

<h2 id="new-feature-introduction">New feature introduction</h2>

<h3 id="automatically-pull-the-remote-cross-compilation-toolchain">Automatically pull the remote cross-compilation toolchain</h3>

<p>Starting from version 2.5.2, we can pull the specified toolchain to integrate the compilation project, and we also support switching the dependent package to the corresponding remote toolchain to participate in the compilation and integration.</p>

<p>For related example codes, see: <a href="https://github.com/xmake-io/xmake/tree/master/tests/projects/package">Toolchain/Packages Examples</a></p>

<p>Related issue <a href="https://github.com/xmake-io/xmake/issues/1217">#1217</a></p>

<p>Currently, we have included the following toolchain packages in the <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> repository, allowing xmake to pull and integrate remotely:</p>

<ul>
  <li>llvm</li>
  <li>llvm-mingw</li>
  <li>gnu-rm</li>
  <li>muslcc</li>
  <li>zig</li>
</ul>

<p>Although there are not many toolchain packages currently supported, but the overall architecture has been opened up, we only need to include more toolchains in the later stage, such as: gcc, tinyc, vs-buildtools and other toolchains.</p>

<p>Since the xmake package supports semantic versions, if the project relies on a specific version of the gcc/clang compiler, users should not bother to install it. xmake will automatically detect whether the gcc/clang version of the current system meets the requirements.</p>

<p>If the version is not satisfied, xmake will pull it remotely, automatically install and integrate a specific version of gcc/clang, and then compile the project.</p>

<h4 id="pull-the-specified-version-of-llvm-toolchain">Pull the specified version of llvm toolchain</h4>

<p>We use clang in llvm-10 to compile the project.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"llvm 10.x"</span><span class="p">,</span> <span class="p">{</span><span class="n">alias</span> <span class="o">=</span> <span class="s2">"llvm-10"</span><span class="p">})</span>
<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c)
    set_toolchains("</span><span class="n">llvm</span><span class="err">@</span><span class="n">llvm</span><span class="o">-</span><span class="mi">10</span><span class="s2">")
</span></code></pre>
</div>

<p>Among them, the first half of <code class="highlighter-rouge">llvm@llvm-10</code> is the toolchain name, which is <code class="highlighter-rouge">toolchain("llvm")</code>, and the following name is the name of the toolchain package that needs to be associated, which is <code class="highlighter-rouge">package("llvm")</code> , But if an alias is set, the alias will be used first: <code class="highlighter-rouge">llvm-10</code></p>

<p>In addition, we will add the gcc toolchain package to xmake-repo in the future, so that users can freely switch to gcc-10, gcc-11 and other specific versions of gcc compilers without the need for users to manually install them.</p>

<h3 id="pull-the-cross-compilation-toolchain">Pull the cross-compilation toolchain</h3>

<p>We can also pull the specified cross-compilation toolchain to compile the project.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"muslcc"</span><span class="p">)</span>
<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c)
    set_toolchains("</span><span class="err">@</span><span class="n">muslcc</span><span class="s2">")
</span></code></pre>
</div>

<p>muslcc is a cross-compilation toolchain provided by https://musl.cc. By default, xmake will automatically integrate and compile the <code class="highlighter-rouge">x86_64-linux-musl-</code> target platform.</p>

<p>Of course, we can also use <code class="highlighter-rouge">xmake f -a arm64</code> to switch to the <code class="highlighter-rouge">aarch64-linux-musl-</code> target platform for cross-compilation.</p>

<h4 id="pull-the-toolchain-and-integrate-the-dependency-packages">Pull the toolchain and integrate the dependency packages</h4>

<p>We can also use the specified muslcc cross-compilation toolchain to compile and integrate all dependent packages.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"muslcc"</span><span class="p">)</span>
<span class="n">add_requires</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">,</span> <span class="s2">"libogg"</span><span class="p">,</span> <span class="p">{</span><span class="n">system</span> <span class="o">=</span> <span class="kc">false</span><span class="p">})</span>

<span class="n">set_toolchains</span><span class="p">(</span><span class="s2">"@muslcc"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">,</span> <span class="s2">"libogg"</span><span class="p">)</span>
</code></pre>
</div>

<p>At this time, the zlib, libogg and other dependent packages configured in the project will also switch to the muslcc toolchain, automatically download, compile and integrate them.</p>

<p>We can also use <code class="highlighter-rouge">set_plat/set_arch</code> to fix the platform, so that only one xmake command is needed to complete the integration of the entire cross-compilation environment and architecture switching.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"muslcc"</span><span class="p">)</span>
<span class="n">add_requires</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">,</span> <span class="s2">"libogg"</span><span class="p">,</span> <span class="p">{</span><span class="n">system</span> <span class="o">=</span> <span class="kc">false</span><span class="p">})</span>

<span class="n">set_plat</span><span class="p">(</span><span class="s2">"cross"</span><span class="p">)</span>
<span class="n">set_arch</span><span class="p">(</span><span class="s2">"arm64"</span><span class="p">)</span>
<span class="n">set_toolchains</span><span class="p">(</span><span class="s2">"@muslcc"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"zlib"</span><span class="p">,</span> <span class="s2">"libogg"</span><span class="p">)</span>
</code></pre>
</div>

<p>For complete examples, see: <a href="https://github.com/xmake-io/xmake/blob/master/tests/projects/package/toolchain_muslcc/xmake.lua">Examples (muslcc)</a></p>

<h4 id="pull-zig-toolchain">Pull Zig toolchain</h4>

<p>xmake will first download a specific version of the zig toolchain, and then use this toolchain to compile the zig project. Of course, if the user has installed the zig toolchain by himself, xmake will also automatically detect whether the corresponding version is satisfied, and if it meets the requirements, it will use it directly , No need to download and install repeatedly.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.debug"</span><span class="p">,</span> <span class="s2">"mode.release"</span><span class="p">)</span>
<span class="n">add_requires</span><span class="p">(</span><span class="s2">"zig 0.7.x"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.zig"</span><span class="p">)</span>
    <span class="n">set_toolchains</span><span class="p">(</span><span class="s2">"@zig"</span><span class="p">)</span>
</code></pre>
</div>

<h3 id="support-for-zig-cc-compiler">Support for zig cc compiler</h3>

<p><code class="highlighter-rouge">zig cc</code> is the built-in c/c++ compiler of zig, which can compile and link c/c++ code completely independently. It does not rely on gcc/clang/msvc at all, which is very powerful.</p>

<p>Therefore, we can use it to compile c/c++ projects. The key is that the zig toolchain is still very lightweight, only tens of M.</p>

<p>We only need to switch to the zig toolchain to complete the compilation:</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f --toolchain<span class="o">=</span>zig
<span class="gp">$ </span>xmake
<span class="o">[</span>25%]: compiling.release src/main.c
<span class="s2">"zig cc"</span> -c -arch x86_64 -fvisibility<span class="o">=</span>hidden -O3 -DNDEBUG -o build/.objs/xmake_test/macosx/x86_64/release/src/main.c.o src/main.c
<span class="o">[</span>50%]: linking.release <span class="nb">test</span>
<span class="s2">"zig c++"</span> -o build/macosx/x86_64/release/test build/.objs/xmake_test/macosx/x86_64/release/src/main.c.o -arch x86_64 -stdlib<span class="o">=</span>libc++ -Wl,-x -lz
<span class="o">[</span>100%]: build ok!
</code></pre>
</div>

<p>In addition, another powerful feature of <code class="highlighter-rouge">zig cc</code> is that it also supports cross-compilation of different architectures, which is so happy.</p>

<p>With xmake, we only need to switch the architecture to arm64 to achieve cross-compilation of arm64, for example:</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f -a arm64 --toolchain<span class="o">=</span>zig
<span class="gp">$ </span>xmake
<span class="o">[</span>25%]: compiling.release src/main.c
<span class="s2">"zig cc"</span> -c -target aarch64-macos-gnu -arch arm64 -fvisibility<span class="o">=</span>hidden -O3 -DNDEBUG -o build/.objs/xmake_test/macosx/arm64/release/src/main.c.o src/main.c
checking <span class="k">for </span>flags <span class="o">(</span>-MMD -MF<span class="o">)</span> ... ok
checking <span class="k">for </span>flags <span class="o">(</span>-fdiagnostics-color<span class="o">=</span>always<span class="o">)</span> ... ok
<span class="o">[</span>50%]: linking.release xmake_test
<span class="s2">"zig c++"</span> -o build/macosx/arm64/release/xmake_test build/.objs/xmake_test/macosx/arm64/release/src/main.co -target aarch64-macos-gnu -arch arm64 -stdlib<span class="o">=</span>libc++ -Wl, -x -lz
<span class="o">[</span>100%]: build ok!
</code></pre>
</div>

<p>Even if you are on macOS, you can use <code class="highlighter-rouge">zig cc</code> to cross-compile windows/x64 target programs, which is equivalent to replacing what mingw does.</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xmake f -p windows -a x64 --toolchain<span class="o">=</span>zig
<span class="gp">$ </span>xmake
</code></pre>
</div>

<h3 id="automatically-export-all-symbols-in-windowsdll">Automatically export all symbols in windows/dll</h3>

<p>There is such a function in cmake: <code class="highlighter-rouge">WINDOWS_EXPORT_ALL_SYMBOLS</code>, the statement in the installation cmake document:</p>

<p><a href="https://cmake.org/cmake/help/latest/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html">https://cmake.org/cmake/help/latest/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html</a></p>

<blockquote>
  <p>Enable this boolean property to automatically create a module definition (.def) file with all global symbols found
in the input .obj files for a SHARED library (or executable with ENABLE_EXPORTS) on Windows.
The module definition file will be passed to the linker causing all symbols to be exported from the .dll. For global data symbols,
__declspec(dllimport) must still be used when compiling against the code in the .dll. All other function symbols will be automatically exported and imported by callers.
This simplifies porting projects to Windows by reducing the need for explicit dllexport markup, even in C++ classes.</p>
</blockquote>

<p>Now, xmake also provides a similar feature, which can quickly export symbols in windows/dll in full to simplify the process of symbol export in the process of porting to third-party projects. In addition, if there are too many symbols in the project, you can also use this to simplify the explicit export requirements in the code.</p>

<p>We only need to configure the <code class="highlighter-rouge">utils.symbols.export_all</code> rule on the corresponding generated dll target.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">target</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/foo.c"</span><span class="p">)</span>
    <span class="n">add_rules</span><span class="p">(</span><span class="s2">"utils.symbols.export_all"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/main.c"</span><span class="p">)</span>
</code></pre>
</div>

<p>xmake will automatically scan all obj object files, then generate the def symbol export file, and pass it to link.exe for fast and full export.</p>

<h3 id="convert-mingwdlla-to-msvclib">Convert mingw/.dll.a to msvc/.lib</h3>

<p>This feature is also based on the CMAKE_GNUtoMS function, which can convert the dynamic library (xxx.dll &amp; xxx.dll.a) generated by MinGW into a format (xxx.dll &amp; xxx.lib) that can be recognized by Visual Studio to achieve mixed compilation.</p>

<p>This feature is particularly helpful for Fortran &amp; C++ mixed projects, because VS does not provide the fortran compiler, you can only use MinGW’s gfortran to compile the fortran part, and then link with the VS project.
Often such projects also have some other libraries provided in the vs format, so it is not possible to compile it purely with MinGW. You can only use this function of cmake to mix and compile.</p>

<p>Therefore, xmake also provides an auxiliary module interface to support it, and the usage is as follows:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">import</span><span class="p">(</span><span class="s2">"utils.platform.gnu2mslib"</span><span class="p">)</span>

<span class="n">gnu2mslib</span><span class="p">(</span><span class="s2">"xxx.lib"</span><span class="p">,</span> <span class="s2">"xxx.dll.a"</span><span class="p">)</span>
<span class="n">gnu2mslib</span><span class="p">(</span><span class="s2">"xxx.lib"</span><span class="p">,</span> <span class="s2">"xxx.def"</span><span class="p">)</span>
<span class="n">gnu2mslib</span><span class="p">(</span><span class="s2">"xxx.lib"</span><span class="p">,</span> <span class="s2">"xxx.dll.a"</span><span class="p">,</span> <span class="p">{</span><span class="n">dllname</span> <span class="o">=</span> <span class="s2">"xxx.dll"</span><span class="p">,</span> <span class="n">arch</span> <span class="o">=</span> <span class="s2">"x64"</span><span class="p">})</span>
</code></pre>
</div>

<p>Support to generate xxx.lib from def, and also support to automatically export .def from xxx.dll.a, and then generate xxx.lib</p>

<p>For details, see: <a href="https://github.com/xmake-io/xmake/issues/1181">issue #1181</a></p>

<h3 id="add-batch-commands-to-simplify-custom-rules">Add batch commands to simplify custom rules</h3>

<p>In order to simplify the configuration of user-defined rules, xmake newly provides custom script entries such as <code class="highlighter-rouge">on_buildcmd_file</code>, <code class="highlighter-rouge">on_buildcmd_files</code>, etc.
We can construct a batch command line task through the batchcmds object, and xmake executes these commands at one time when actually executing the build.</p>

<p>This is very useful for project generator plugins such as <code class="highlighter-rouge">xmake project</code>, because third-party project files generated by the generator do not support the execution of built-in scripts such as <code class="highlighter-rouge">on_build_files</code>.</p>

<p>But the final result of the <code class="highlighter-rouge">on_buildcmd_file</code> construction is a batch of original cmd command lines, which can be directly executed as custom commands for other project files.</p>

<p>In addition, compared to <code class="highlighter-rouge">on_build_file</code>, it also simplifies the implementation of compiling extension files, is more readable and easy to configure, and is more user-friendly.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">rule</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span>
    <span class="n">set_extensions</span><span class="p">(</span><span class="s2">".xxx"</span><span class="p">)</span>
    <span class="n">on_buildcmd_file</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">batchcmds</span><span class="p">,</span> <span class="n">sourcefile</span><span class="p">,</span> <span class="n">opt</span><span class="p">)</span>
        <span class="n">batchcmds</span><span class="p">:</span><span class="n">vrunv</span><span class="p">(</span><span class="s2">"gcc"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"-o"</span><span class="p">,</span> <span class="n">objectfile</span><span class="p">,</span> <span class="s2">"-c"</span><span class="p">,</span> <span class="n">sourcefile</span><span class="p">})</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>In addition to <code class="highlighter-rouge">batchcmds:vrunv</code>, we also support some other batch commands, such as:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">batchcmds</span><span class="p">:</span><span class="n">show</span><span class="p">(</span><span class="s2">"hello %s"</span><span class="p">,</span> <span class="s2">"xmake"</span><span class="p">)</span>
<span class="n">batchcmds</span><span class="p">:</span><span class="n">vrunv</span><span class="p">(</span><span class="s2">"gcc"</span><span class="p">,</span> <span class="p">{</span><span class="s2">"-o"</span><span class="p">,</span> <span class="n">objectfile</span><span class="p">,</span> <span class="s2">"-c"</span><span class="p">,</span> <span class="n">sourcefile</span><span class="p">},</span> <span class="p">{</span><span class="n">envs</span> <span class="o">=</span> <span class="p">{</span><span class="n">LD_LIBRARY_PATH</span><span class="o">=</span><span class="s2">"/xxx"</span><span class="p">}})</span>
<span class="n">batchcmds</span><span class="p">:</span><span class="n">mkdir</span><span class="p">(</span><span class="s2">"/xxx"</span><span class="p">)</span> <span class="c1">-- and cp, mv, rm, ln ..</span>
<span class="n">batchcmds</span><span class="p">:</span><span class="n">compile</span><span class="p">(</span><span class="n">sourcefile_cx</span><span class="p">,</span> <span class="n">objectfile</span><span class="p">,</span> <span class="p">{</span><span class="n">configs</span> <span class="o">=</span> <span class="p">{</span><span class="n">includedirs</span> <span class="o">=</span> <span class="n">sourcefile_dir</span><span class="p">,</span> <span class="n">languages</span> <span class="o">=</span> <span class="p">(</span><span class="n">sourcekind</span> <span class="o">==</span> <span class="s2">"cxx"</span> <span class="ow">and</span> <span class="s2">"c++11"</span><span class="p">)}})</span>
<span class="n">batchcmds</span><span class="p">:</span><span class="n">link</span><span class="p">(</span><span class="n">objectfiles</span><span class="p">,</span> <span class="n">targetfile</span><span class="p">,</span> <span class="p">{</span><span class="n">configs</span> <span class="o">=</span> <span class="p">{</span><span class="n">linkdirs</span> <span class="o">=</span> <span class="s2">""</span><span class="p">}})</span>
</code></pre>
</div>

<p>At the same time, we also simplify the configuration of dependency execution in it. The following is a complete example:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">rule</span><span class="p">(</span><span class="s2">"lex"</span><span class="p">)</span>
    <span class="n">set_extensions</span><span class="p">(</span><span class="s2">".l"</span><span class="p">,</span> <span class="s2">".ll"</span><span class="p">)</span>
    <span class="n">on_buildcmd_file</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">batchcmds</span><span class="p">,</span> <span class="n">sourcefile_lex</span><span class="p">,</span> <span class="n">opt</span><span class="p">)</span>

        <span class="c1">-- imports</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"lib.detect.find_tool"</span><span class="p">)</span>

        <span class="c1">-- get lex</span>
        <span class="kd">local</span> <span class="n">lex</span> <span class="o">=</span> <span class="nb">assert</span><span class="p">(</span><span class="n">find_tool</span><span class="p">(</span><span class="s2">"flex"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">find_tool</span><span class="p">(</span><span class="s2">"lex"</span><span class="p">),</span> <span class="s2">"lex not found!"</span><span class="p">)</span>

        <span class="c1">-- get c/c++ source file for lex</span>
        <span class="kd">local</span> <span class="n">extension</span> <span class="o">=</span> <span class="n">path</span><span class="p">.</span><span class="n">extension</span><span class="p">(</span><span class="n">sourcefile_lex</span><span class="p">)</span>
        <span class="kd">local</span> <span class="n">sourcefile_cx</span> <span class="o">=</span> <span class="n">path</span><span class="p">.</span><span class="n">join</span><span class="p">(</span><span class="n">target</span><span class="p">:</span><span class="n">autogendir</span><span class="p">(),</span> <span class="s2">"rules"</span><span class="p">,</span> <span class="s2">"lex_yacc"</span><span class="p">,</span> <span class="n">path</span><span class="p">.</span><span class="n">basename</span><span class="p">(</span><span class="n">sourcefile_lex</span><span class="p">)</span> <span class="o">..</span> <span class="p">(</span><span class="n">extension</span> <span class="o">==</span> <span class="s2">".ll"</span> <span class="ow">and</span> <span class="s2">".cpp"</span> <span class="ow">or</span> <span class="s2">".c"</span><span class="p">))</span>

        <span class="c1">-- add objectfile</span>
        <span class="kd">local</span> <span class="n">objectfile</span> <span class="o">=</span> <span class="n">target</span><span class="p">:</span><span class="n">objectfile</span><span class="p">(</span><span class="n">sourcefile_cx</span><span class="p">)</span>
        <span class="nb">table.insert</span><span class="p">(</span><span class="n">target</span><span class="p">:</span><span class="n">objectfiles</span><span class="p">(),</span> <span class="n">objectfile</span><span class="p">)</span>

        <span class="c1">-- add commands</span>
        <span class="n">batchcmds</span><span class="p">:</span><span class="n">show_progress</span><span class="p">(</span><span class="n">opt</span><span class="p">.</span><span class="n">progress</span><span class="p">,</span> <span class="s2">"${color.build.object}compiling.lex %s"</span><span class="p">,</span> <span class="n">sourcefile_lex</span><span class="p">)</span>
        <span class="n">batchcmds</span><span class="p">:</span><span class="n">mkdir</span><span class="p">(</span><span class="n">path</span><span class="p">.</span><span class="n">directory</span><span class="p">(</span><span class="n">sourcefile_cx</span><span class="p">))</span>
        <span class="n">batchcmds</span><span class="p">:</span><span class="n">vrunv</span><span class="p">(</span><span class="n">lex</span><span class="p">.</span><span class="n">program</span><span class="p">,</span> <span class="p">{</span><span class="s2">"-o"</span><span class="p">,</span> <span class="n">sourcefile_cx</span><span class="p">,</span> <span class="n">sourcefile_lex</span><span class="p">})</span>
        <span class="n">batchcmds</span><span class="p">:</span><span class="n">compile</span><span class="p">(</span><span class="n">sourcefile_cx</span><span class="p">,</span> <span class="n">objectfile</span><span class="p">)</span>

        <span class="c1">-- add deps</span>
        <span class="n">batchcmds</span><span class="p">:</span><span class="n">add_depfiles</span><span class="p">(</span><span class="n">sourcefile_lex</span><span class="p">)</span>
        <span class="n">batchcmds</span><span class="p">:</span><span class="n">set_depmtime</span><span class="p">(</span><span class="n">os</span><span class="p">.</span><span class="n">mtime</span><span class="p">(</span><span class="n">objectfile</span><span class="p">))</span>
        <span class="n">batchcmds</span><span class="p">:</span><span class="n">set_depcache</span><span class="p">(</span><span class="n">target</span><span class="p">:</span><span class="n">dependfile</span><span class="p">(</span><span class="n">objectfile</span><span class="p">))</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>As we can see from the above configuration, the overall execution command list is very clear, and if we use <code class="highlighter-rouge">on_build_file</code> to implement it,
we can compare the configuration of the previous rule, and we can intuitively feel that the configuration of the new interface is indeed simplified a lot.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">rule</span><span class="p">(</span><span class="s2">"lex"</span><span class="p">)</span>

    <span class="c1">-- set extension</span>
    <span class="n">set_extensions</span><span class="p">(</span><span class="s2">".l"</span><span class="p">,</span> <span class="s2">".ll"</span><span class="p">)</span>

    <span class="c1">-- load lex/flex</span>
    <span class="n">before_load</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"core.project.config"</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"lib.detect.find_tool"</span><span class="p">)</span>
        <span class="kd">local</span> <span class="n">lex</span> <span class="o">=</span> <span class="n">config</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"__lex"</span><span class="p">)</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">lex</span> <span class="k">then</span>
            <span class="n">lex</span> <span class="o">=</span> <span class="n">find_tool</span><span class="p">(</span><span class="s2">"flex"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">find_tool</span><span class="p">(</span><span class="s2">"lex"</span><span class="p">)</span>
            <span class="k">if</span> <span class="n">lex</span> <span class="ow">and</span> <span class="n">lex</span><span class="p">.</span><span class="n">program</span> <span class="k">then</span>
                <span class="n">config</span><span class="p">.</span><span class="n">set</span><span class="p">(</span><span class="s2">"__lex"</span><span class="p">,</span> <span class="n">lex</span><span class="p">.</span><span class="n">program</span><span class="p">)</span>
                <span class="n">cprint</span><span class="p">(</span><span class="s2">"checking for Lex ... ${color.success}%s"</span><span class="p">,</span> <span class="n">lex</span><span class="p">.</span><span class="n">program</span><span class="p">)</span>
            <span class="k">else</span>
                <span class="n">cprint</span><span class="p">(</span><span class="s2">"checking for Lex ... ${color.nothing}${text.nothing}"</span><span class="p">)</span>
                <span class="n">raise</span><span class="p">(</span><span class="s2">"lex/flex not found!"</span><span class="p">)</span>
            <span class="k">end</span>
        <span class="k">end</span>
    <span class="k">end</span><span class="p">)</span>

    <span class="c1">-- build lex file</span>
    <span class="n">on_build_file</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">sourcefile_lex</span><span class="p">,</span> <span class="n">opt</span><span class="p">)</span>

        <span class="c1">-- imports</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"core.base.option"</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"core.theme.theme"</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"core.project.config"</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"core.project.depend"</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"core.tool.compiler"</span><span class="p">)</span>
        <span class="n">import</span><span class="p">(</span><span class="s2">"private.utils.progress"</span><span class="p">)</span>

        <span class="c1">-- get lex</span>
        <span class="kd">local</span> <span class="n">lex</span> <span class="o">=</span> <span class="nb">assert</span><span class="p">(</span><span class="n">config</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"__lex"</span><span class="p">),</span> <span class="s2">"lex not found!"</span><span class="p">)</span>

        <span class="c1">-- get extension: .l/.ll</span>
        <span class="kd">local</span> <span class="n">extension</span> <span class="o">=</span> <span class="n">path</span><span class="p">.</span><span class="n">extension</span><span class="p">(</span><span class="n">sourcefile_lex</span><span class="p">)</span>

        <span class="c1">-- get c/c++ source file for lex</span>
        <span class="kd">local</span> <span class="n">sourcefile_cx</span> <span class="o">=</span> <span class="n">path</span><span class="p">.</span><span class="n">join</span><span class="p">(</span><span class="n">target</span><span class="p">:</span><span class="n">autogendir</span><span class="p">(),</span> <span class="s2">"rules"</span><span class="p">,</span> <span class="s2">"lex_yacc"</span><span class="p">,</span> <span class="n">path</span><span class="p">.</span><span class="n">basename</span><span class="p">(</span><span class="n">sourcefile_lex</span><span class="p">)</span> <span class="o">..</span> <span class="p">(</span><span class="n">extension</span> <span class="o">==</span> <span class="s2">".ll"</span> <span class="ow">and</span> <span class="s2">".cpp"</span> <span class="ow">or</span> <span class="s2">".c"</span><span class="p">))</span>
        <span class="kd">local</span> <span class="n">sourcefile_dir</span> <span class="o">=</span> <span class="n">path</span><span class="p">.</span><span class="n">directory</span><span class="p">(</span><span class="n">sourcefile_cx</span><span class="p">)</span>

        <span class="c1">-- get object file</span>
        <span class="kd">local</span> <span class="n">objectfile</span> <span class="o">=</span> <span class="n">target</span><span class="p">:</span><span class="n">objectfile</span><span class="p">(</span><span class="n">sourcefile_cx</span><span class="p">)</span>

        <span class="c1">-- load compiler</span>
        <span class="kd">local</span> <span class="n">compinst</span> <span class="o">=</span> <span class="n">compiler</span><span class="p">.</span><span class="n">load</span><span class="p">((</span><span class="n">extension</span> <span class="o">==</span> <span class="s2">".ll"</span> <span class="ow">and</span> <span class="s2">"cxx"</span> <span class="ow">or</span> <span class="s2">"cc"</span><span class="p">),</span> <span class="p">{</span><span class="n">target</span> <span class="o">=</span> <span class="n">target</span><span class="p">})</span>

        <span class="c1">-- get compile flags</span>
        <span class="kd">local</span> <span class="n">compflags</span> <span class="o">=</span> <span class="n">compinst</span><span class="p">:</span><span class="n">compflags</span><span class="p">({</span><span class="n">target</span> <span class="o">=</span> <span class="n">target</span><span class="p">,</span> <span class="n">sourcefile</span> <span class="o">=</span> <span class="n">sourcefile_cx</span><span class="p">})</span>

        <span class="c1">-- add objectfile</span>
        <span class="nb">table.insert</span><span class="p">(</span><span class="n">target</span><span class="p">:</span><span class="n">objectfiles</span><span class="p">(),</span> <span class="n">objectfile</span><span class="p">)</span>

        <span class="c1">-- load dependent info</span>
        <span class="kd">local</span> <span class="n">dependfile</span> <span class="o">=</span> <span class="n">target</span><span class="p">:</span><span class="n">dependfile</span><span class="p">(</span><span class="n">objectfile</span><span class="p">)</span>
        <span class="kd">local</span> <span class="n">dependinfo</span> <span class="o">=</span> <span class="n">option</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"rebuild"</span><span class="p">)</span> <span class="ow">and</span> <span class="p">{}</span> <span class="ow">or</span> <span class="p">(</span><span class="n">depend</span><span class="p">.</span><span class="n">load</span><span class="p">(</span><span class="n">dependfile</span><span class="p">)</span> <span class="ow">or</span> <span class="p">{})</span>

        <span class="c1">-- need build this object?</span>
        <span class="kd">local</span> <span class="n">depvalues</span> <span class="o">=</span> <span class="p">{</span><span class="n">compinst</span><span class="p">:</span><span class="n">program</span><span class="p">(),</span> <span class="n">compflags</span><span class="p">}</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">depend</span><span class="p">.</span><span class="n">is_changed</span><span class="p">(</span><span class="n">dependinfo</span><span class="p">,</span> <span class="p">{</span><span class="n">lastmtime</span> <span class="o">=</span> <span class="n">os</span><span class="p">.</span><span class="n">mtime</span><span class="p">(</span><span class="n">objectfile</span><span class="p">),</span> <span class="n">values</span> <span class="o">=</span> <span class="n">depvalues</span><span class="p">})</span> <span class="k">then</span>
            <span class="k">return</span>
        <span class="k">end</span>

        <span class="c1">-- trace progress info</span>
        <span class="n">progress</span><span class="p">.</span><span class="n">show</span><span class="p">(</span><span class="n">opt</span><span class="p">.</span><span class="n">progress</span><span class="p">,</span> <span class="s2">"${color.build.object}compiling.lex %s"</span><span class="p">,</span> <span class="n">sourcefile_lex</span><span class="p">)</span>

        <span class="c1">-- ensure the source file directory</span>
        <span class="k">if</span> <span class="ow">not</span> <span class="n">os</span><span class="p">.</span><span class="n">isdir</span><span class="p">(</span><span class="n">sourcefile_dir</span><span class="p">)</span> <span class="k">then</span>
            <span class="n">os</span><span class="p">.</span><span class="n">mkdir</span><span class="p">(</span><span class="n">sourcefile_dir</span><span class="p">)</span>
        <span class="k">end</span>

        <span class="c1">-- compile lex</span>
        <span class="n">os</span><span class="p">.</span><span class="n">vrunv</span><span class="p">(</span><span class="n">lex</span><span class="p">,</span> <span class="p">{</span><span class="s2">"-o"</span><span class="p">,</span> <span class="n">sourcefile_cx</span><span class="p">,</span> <span class="n">sourcefile_lex</span><span class="p">})</span>

        <span class="c1">-- trace</span>
        <span class="k">if</span> <span class="n">option</span><span class="p">.</span><span class="n">get</span><span class="p">(</span><span class="s2">"verbose"</span><span class="p">)</span> <span class="k">then</span>
            <span class="nb">print</span><span class="p">(</span><span class="n">compinst</span><span class="p">:</span><span class="n">compcmd</span><span class="p">(</span><span class="n">sourcefile_cx</span><span class="p">,</span> <span class="n">objectfile</span><span class="p">,</span> <span class="p">{</span><span class="n">compflags</span> <span class="o">=</span> <span class="n">compflags</span><span class="p">}))</span>
        <span class="k">end</span>

        <span class="c1">-- compile c/c++ source file for lex</span>
        <span class="n">dependinfo</span><span class="p">.</span><span class="n">files</span> <span class="o">=</span> <span class="p">{}</span>
        <span class="nb">assert</span><span class="p">(</span><span class="n">compinst</span><span class="p">:</span><span class="n">compile</span><span class="p">(</span><span class="n">sourcefile_cx</span><span class="p">,</span> <span class="n">objectfile</span><span class="p">,</span> <span class="p">{</span><span class="n">dependinfo</span> <span class="o">=</span> <span class="n">dependinfo</span><span class="p">,</span> <span class="n">compflags</span> <span class="o">=</span> <span class="n">compflags</span><span class="p">}))</span>

        <span class="c1">-- update files and values to the dependent file</span>
        <span class="n">dependinfo</span><span class="p">.</span><span class="n">values</span> <span class="o">=</span> <span class="n">depvalues</span>
        <span class="nb">table.insert</span><span class="p">(</span><span class="n">dependinfo</span><span class="p">.</span><span class="n">files</span><span class="p">,</span> <span class="n">sourcefile_lex</span><span class="p">)</span>
        <span class="n">depend</span><span class="p">.</span><span class="n">save</span><span class="p">(</span><span class="n">dependinfo</span><span class="p">,</span> <span class="n">dependfile</span><span class="p">)</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>For a detailed description and background of this, see: <a href="https://github.com/xmake-io/xmake/issues/1246">issue 1246</a></p>

<h3 id="dependent-package-configuration-improvements">Dependent package configuration improvements</h3>

<h4 id="use-add_extsources-to-improve-package-name-lookup">Use add_extsources to improve package name lookup</h4>

<p>Regarding the definition of remote dependency packages, we have also added two configuration interfaces <code class="highlighter-rouge">add_extsources</code> and <code class="highlighter-rouge">on_fetch</code>, which can better configure xmake to search for system libraries during the process of installing C/C++ packages.</p>

<p>As for the specific background, we can give an example. For example, we added a package of <code class="highlighter-rouge">package("libusb")</code> to the <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> repository .</p>

<p>Then users can directly integrate and use it in the following ways:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_requires</span><span class="p">(</span><span class="s2">"libusb"</span><span class="p">)</span>
<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.c"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"libusb"</span><span class="p">)</span>
</code></pre>
</div>

<p>If libusb is not installed on the user’s system, xmake will automatically download the libusb library source code, automatically compile, install and integrate, and there is no problem.</p>

<p>But if the user installs the libusb library to the system through <code class="highlighter-rouge">apt install libusb-1.0</code>, then xmake should automatically search for the libusb package installed by the user in the system environment first, and use it directly, avoiding additional download, compilation and installation.</p>

<p>But here comes the problem, xmake internally passes <code class="highlighter-rouge">find_package("libusb")</code> and fails to find it. Why is that? Because the package name of libusb installed via apt is <code class="highlighter-rouge">libusb-1.0</code>, not libusb.</p>

<p>We can only find it through <code class="highlighter-rouge">pkg-config --cflags libusb-1.0</code>, but the default find_package logic inside xmake doesn’t know the existence of <code class="highlighter-rouge">libusb-1.0</code>, so it can’t be found.</p>

<p>Therefore, in order to better adapt to the search of system libraries in different system environments, we can use <code class="highlighter-rouge">add_extsources("pkgconfig::libusb-1.0")</code> to let xmake improve the search logic, for example:</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">package</span><span class="p">(</span><span class="s2">"libusb"</span><span class="p">)</span>
    <span class="n">add_extsources</span><span class="p">(</span><span class="s2">"pkgconfig::libusb-1.0"</span><span class="p">)</span>
    <span class="n">on_install</span><span class="p">(</span><span class="k">function</span> <span class="p">(</span><span class="n">package</span><span class="p">)</span>
        <span class="c1">-- ...</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<p>In addition, we can also use this method to improve the search for packages installed by other package managers such as homebrew/pacman, for example: <code class="highlighter-rouge">add_extsources("pacman::libusb-1.0")</code>.</p>

<h4 id="use-on_fetch-to-improve-find-system-libraries">Use on_fetch to improve find system libraries</h4>

<p>If the system libraries installed under different systems only have different package names, it is enough to use <code class="highlighter-rouge">add_extsources</code> to improve the system library search, which is simple and convenient.</p>

<p>However, if some packages are installed in the system, the location is more complicated. To find them, some additional scripts may be needed. For example: access to the registry under windows to find packages, etc. At this time, we can use <code class="highlighter-rouge">on_fetch </code>Fully customized search system library logic.</p>

<p>Let’s take libusb as an example. Instead of <code class="highlighter-rouge">add_extsources</code>, we can use the following method to achieve the same effect. Of course, we can do more things in it.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">package</span><span class="p">(</span><span class="s2">"libusb"</span><span class="p">)</span>
    <span class="n">on_fetch</span><span class="p">(</span><span class="s2">"linux"</span><span class="p">,</span> <span class="k">function</span><span class="p">(</span><span class="n">package</span><span class="p">,</span> <span class="n">opt</span><span class="p">)</span>
        <span class="k">if</span> <span class="n">opt</span><span class="p">.</span><span class="n">system</span> <span class="k">then</span>
            <span class="k">return</span> <span class="n">find_package</span><span class="p">(</span><span class="s2">"pkgconfig::libusb-1.0"</span><span class="p">)</span>
        <span class="k">end</span>
    <span class="k">end</span><span class="p">)</span>
</code></pre>
</div>

<h3 id="support-manifest-file-on-windows">Support manifest file on windows</h3>

<p>In the new version, we also added support for windows <code class="highlighter-rouge">.manifest</code> files, just add it through <code class="highlighter-rouge">add_files</code>.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.debug"</span><span class="p">,</span> <span class="s2">"mode.release"</span><span class="p">)</span>
<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.cpp"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/*.manifest"</span><span class="p">)</span>
</code></pre>
</div>

<h3 id="improve-xrepo-command">Improve xrepo command</h3>

<p>Regarding the xrepo command, we have also improved it slightly. Now you can batch uninstall and delete the installed packages through the following command, and support pattern matching:</p>

<div class="language-bash highlighter-rouge"><pre class="highlight"><code><span class="gp">$ </span>xrepo remove --all
<span class="gp">$ </span>xrepo remove --all zlib pcr<span class="k">*</span>
</code></pre>
</div>

<h3 id="support-to-export-package-configuration">Support to export package configuration</h3>

<p>We have also improved <code class="highlighter-rouge">add_packages</code> so that it also supports <code class="highlighter-rouge"><span class="p">{</span><span class="err">public</span><span class="w"> </span><span class="err">=</span><span class="w"> </span><span class="err">true</span><span class="p">}</span></code> to export package configuration to the parent target.</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_rules</span><span class="p">(</span><span class="s2">"mode.debug"</span><span class="p">,</span> <span class="s2">"mode.release"</span><span class="p">)</span>
<span class="n">add_requires</span><span class="p">(</span><span class="s2">"pcre2"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"shared"</span><span class="p">)</span>
    <span class="n">add_packages</span><span class="p">(</span><span class="s2">"pcre2"</span><span class="p">,</span> <span class="p">{</span><span class="n">public</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/test.cpp"</span><span class="p">)</span>

<span class="n">target</span><span class="p">(</span><span class="s2">"demo"</span><span class="p">)</span>
    <span class="n">add_deps</span><span class="p">(</span><span class="s2">"test"</span><span class="p">)</span>
    <span class="n">set_kind</span><span class="p">(</span><span class="s2">"binary"</span><span class="p">)</span>
    <span class="n">add_files</span><span class="p">(</span><span class="s2">"src/main.cpp"</span><span class="p">)</span> <span class="c1">-- here we can use the pcre2 library exported by the test target</span>
</code></pre>
</div>

<p>it’s private by default, but links/linkdirs will still be exported automatically</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_packages</span><span class="p">(</span><span class="s2">"pcre2"</span><span class="p">)</span>
</code></pre>
</div>

<p>it will export all, contains includedirs, defines</p>

<div class="language-lua highlighter-rouge"><pre class="highlight"><code><span class="n">add_packages</span><span class="p">(</span><span class="s2">"pcre2"</span><span class="p">,</span> <span class="p">{</span><span class="n">public</span> <span class="o">=</span> <span class="kc">true</span><span class="p">})</span>
</code></pre>
</div>

<h2 id="changelog">Changelog</h2>

<h3 id="new-features">New features</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/955#issuecomment-766481512">#955</a>: Support <code class="highlighter-rouge">zig cc</code> and <code class="highlighter-rouge">zig c++</code> as c/c++ compiler</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/955#issuecomment-768193083">#955</a>: Support zig cross-compilation</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1177">#1177</a>: Improve to detect terminal and color codes</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1216">#1216</a>: Pass custom configuration scripts to xrepo</li>
  <li>Add linuxos builtin module to get linux system information</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1217">#1217</a>: Support to fetch remote toolchain package when building project</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1123">#1123</a>: Add <code class="highlighter-rouge">rule("utils.symbols.export_all")</code> to export all symbols for windows/dll</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1181">#1181</a>: Add <code class="highlighter-rouge">utils.platform.gnu2mslib(mslib, gnulib)</code> module api to convert mingw/xxx.dll.a to msvc xxx.lib</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1246">#1246</a>: Improve rules and generators to support commands list</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1239">#1239</a>: Add <code class="highlighter-rouge">add_extsources</code> to improve find external packages</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1241">#1241</a>: Support add .manifest files for windows program</li>
  <li>Support to use <code class="highlighter-rouge">xrepo remove --all</code> to remove all packages</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1254">#1254</a>: Support to export packages to parent target</li>
</ul>

<h3 id="change">Change</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/1226">#1226</a>: Add missing qt include directories</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1183">#1183</a>: Improve c++ lanuages to support Qt6</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1237">#1237</a>: Add qt.ui files for vsxmake plugin</li>
  <li>Improve vs/vsxmake plugins to support precompiled header and intellisense</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1090">#1090</a>: Simplify integration of custom code generators</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1065">#1065</a>: Improve protobuf rule to support compile_commands generators</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1249">#1249</a>: Improve vs/vsxmake generator to support startproject</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/605">#605</a>: Improve to link orders for add_deps/add_packages</li>
  <li>Remove deprecated <code class="highlighter-rouge">add_defines_h_if_ok</code> and <code class="highlighter-rouge">add_defines_h</code> apis for option</li>
</ul>

<h3 id="bugs-fixed">Bugs fixed</h3>

<ul>
  <li><a href="https://github.com/xmake-io/xmake/issues/1219">#1219</a>: Fix version check and update</li>
  <li><a href="https://github.com/xmake-io/xmake/issues/1235">#1235</a>: Fix include directories with spaces</li>
</ul>

        </article>
        <hr>

        <!-- baidu ads -->
        

        
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
                    
                    <h2 id="chinese">中文</h2>
                    <ul>
                    
                    <li class="relatedPost">
                        <a href="/cn/2021/02/27/xmake-update-v2.5.2/">xmake v2.5.2 发布, 支持自动拉取交叉工具链和依赖包集成
                        
                        </a>
                    </li>
                    
                    
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
        
            
        
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
            
        
            
            
                
            
        
        
            </ul>
        

        
        
            
            
            
                
                    
                        
                        <h2 id="similar_posts">Similar Posts</h2>
                        <ul>
                        
                        <li class="relatedPost">
                            <a href="/2021/12/17/xmake-update-v2.6.2/">Xmake v2.6.2 released, Support building Linux kernel driver module
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/12/03/xmake-update-v2.6.1/">xmake v2.6.1 released, Switch to Lua5.4 runtime, Support Rust and C++ mixed compilation
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/10/30/xmake-update-v2.5.9/">xmake v2.5.9 released, Improve C++20 Modules and support Nim, Keil MDK and Unity Build
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/10/08/xmake-update-v2.5.8/">xmake v2.5.8 is released, Support Pascal/Swig program and Lua53 runtime
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
            
            
            
                
                    
                        
                        <li class="relatedPost">
                            <a href="/2021/08/29/xmake-update-v2.5.7/">xmake v2.5.7 released, Use lockfile to freeze package dependencies and Vala/Metal language support
                            
                            </a>
                        </li>
                        
                        
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
                    
                
            
            
        
            
        
        
            </ul>
        

        <div class="post-recent">
    <div class="pre">

        

        

        
        
        

        

        

        
        
        <p><strong>Prev Post</strong> <a href="/2021/01/22/luarocks-build-xmake-v1.0/">A luarocks build plugin for lua module with c/c++ based on xmake</a></p>
        
    </div>

    <div class="nex">

        

        

        
        
        

        

        

        
        
        <p><strong>Next Post</strong> <a href="/2021/04/08/xmake-update-v2.5.3/">xmake v2.5.3 Released, Support to build Linux bpf program and integrate Conda packages</a></p>
        
    </div>
</div>


        <h2 id="comments">Comments</h2>
        






<div id="gitalk-container"></div>
<link rel="stylesheet" href="/css/gitalk.css">
<script src="/js/gitalk.min.js"></script>

<script>
const gitalk = new Gitalk({
  clientID: '73946dc1d9e2276ad0da',
  clientSecret: '12a3cb94361ba3ebc6ecb68cf80d592bfaa8106d',
  repo: 'tboox.github.io',
  owner: 'waruqi',
  admin: ['waruqi'],
  id: location.pathname,      
  language: 'en',
  distractionFreeMode: false  
})

gitalk.render('gitalk-container')
</script>





    </div>
    <button class="anchor"><i class="fa fa-anchor"></i></button>
    <div class="right">
        <div class="wrap">


            <!-- codefund ads -->
            

            <!-- Content -->
            <div class="side content">
                <div>
                    Content
                </div>
                <ul id="content-side" class="content-ul">
                    <li><a href="#chinese">中文</a></li>
                    <li><a href="#similar_posts">Similar Posts</a></li>
                    <li><a href="#comments">Comments</a></li>
                </ul>
            </div>

            <!-- baidu ads -->
            

            <br>
            <div class="side">
                <div>
                    <i class="fa fa-external-link"></i>
                    Links
                </div>
                <ul class="content-ul">
                  <li><a href="http://github.com/waruqi/tbox">tbox</a></li>
                  <li><a href="http://www.xmake.io">xmake</a></li>
                  <li><a href="https://github.com/waruqi">github</a></li>
                </ul>
            </div> 

            <!-- google ads -->
            

            <!-- baidu ads -->
            

            <!-- chitika ads -->
            
        </div>
    </div>

    <!-- baidu ads -->
    
</div>
<script>
/**
 * target _blank
 */
(function() {
    var aTags = document.querySelectorAll('article a:not([id])')
    for (var i = 0; i < aTags.length; i++) {
        aTags[i].setAttribute('target', '_blank')
    }
}());
</script>
<script src="/js/pageContent.js " charset="utf-8"></script>



    <footer class="site-footer">
    <div class="wrapper">
        <p class="description">
             Copyright (c) 2016-2020 tboox.org 
        </p>
        <p class="contact">
            
            <a href="https://github.com/waruqi" title="GitHub"><i class="fa fa-github" aria-hidden="true"></i></a> 
             
            
            <a href="mailto:waruqi@gmail.com" title="email"><i class="fa fa-envelope-o" aria-hidden="true"></i></a> 
            
            
            <a href="https://twitter.com/waruqi" title="Twitter"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
            
            <a href="/feed.xml" title="feed"><i class="fa fa-feed" aria-hidden="true"></i></a> 
        </p>
        <p class="power">
            <span>
                Site powered by <a href="https://jekyllrb.com/">Jekyll</a> & <a href="https://github.com/Gaohaoyang">HyG</a> & <a href="https://pages.github.com/">Github Pages</a>.
            </span>
        </p>
    </div>
</footer>

    <div class="back-to-top">
    <a href="#top" class="scroll">
        <i class="fa fa-arrow-up" aria-hidden="true"></i>
    </a>
</div>

    <script src=" /js/main.js " charset="utf-8"></script>
    <script src=" /js/scroll.min.js " charset="utf-8"></script>
  </body>

</html>
